package Day2025_02_19;

import java.util.HashMap;
import java.util.Map;

public class LeetCode3 {
    public int lengthOfLongestSubstring(String s) {
        char[] nums = s.toCharArray();
        int[] hash = new int[128];
        int maxLen = 0;
        for (int left = 0, right = 0; right < nums.length; right++) {
            int start = nums[right];
            hash[start]++;
            while (hash[start] > 1) {
                int end = nums[left++];
                hash[end]--;
            }
            maxLen = Math.max(right - left + 1, maxLen);
        }
        return maxLen;
    }

    public static void main(String[] args) {
        String s = " ";
//        System.out.println(lengthOfLongestSubstring(s));
    }
}
